#ifndef __I2C_H
#define __I2C_H

#include "main.h"

#define I2C_CLK RCU_GPIOB
#define I2C_SCL_PORT GPIOB
#define I2C_SDA_PORT GPIOB
#define I2C_SCL_PIN GPIO_PIN_6
#define I2C_SDA_PIN GPIO_PIN_7

#define I2C_SCL_SET() gpio_bit_set(I2C_SCL_PORT, I2C_SCL_PIN)
#define I2C_SCL_RESET() gpio_bit_reset(I2C_SCL_PORT, I2C_SCL_PIN)

#define I2C_SDA_SET() gpio_bit_set(I2C_SDA_PORT, I2C_SDA_PIN)
#define I2C_SDA_RESET() gpio_bit_reset(I2C_SDA_PORT, I2C_SDA_PIN)

// #define I2C_SCL_READ() gpio_input_bit_get(I2C_SCL_PORT, I2C_SCL_PIN)
#define I2C_SDA_READ() gpio_input_bit_get(I2C_SDA_PORT, I2C_SDA_PIN)

void I2CInit(void);
uint8_t I2CWrite(uint8_t deviceAddr, uint8_t *data, uint8_t dataLen);
uint8_t I2CRead(uint8_t deviceAddr, uint8_t *data, uint8_t dataLen);

#endif
